/* Jlogin.java 
* Created on Nov 29, 2012 
*@Author: Mr.Viet 
*@Phone: 01683430426 
*@Email: phamvanvietcdhd@gmail.com
*/ 
package com.session2; 

import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import net.miginfocom.swing.MigLayout;

public class Jlogin extends JDialog implements ActionListener{
	private JTextField txtname;
	private JPasswordField txtpass;
	private JButton btnLogin,btnReset;
	public MainFram parentForm;
	public void createForm(){
		this.setLayout(new MigLayout());
		this.txtname = new JTextField(15);
		this.txtname.setText(this.parentForm.getUsername());
		this.txtpass = new JPasswordField(15);
		this.btnLogin = new JButton("Login");
		this.btnReset = new JButton("Reset");
		
		Container con = this.getContentPane();
		con.add(new JLabel("Username"));
		con.add(this.txtname,"wrap");
		con.add(new JLabel("PassWork"));
		con.add(this.txtpass,"wrap");
		con.add(this.btnLogin);
		con.add(this.btnReset);
		
//		Dang Ki Su Kien
		this.btnLogin.addActionListener(this);
	}
	public void showForm(){
		this.setTitle("Demo");
		this.setSize(400, 300);
		this.setVisible(true);
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == this.btnLogin){
//			JOptionPane.showMessageDialog(this, this.txtname.getText());
//			JOptionPane.showMessageDialog(this, "Noi Dung", "Thong Bao", JOptionPane.OK_OPTION,null);
//			int reult = JOptionPane.showConfirmDialog(this,"Are You Sure","Confirm",JOptionPane.OK_CANCEL_OPTION);
//			if(reult == JOptionPane.OK_OPTION){
//				JOptionPane.showMessageDialog(this, "Thanks");
//			}else if(reult == JOptionPane.CANCEL_OPTION){
//				JOptionPane.showMessageDialog(this,"Good Buy");
//			}
			String Values = JOptionPane.showInputDialog("Nhap Du Lieu");
			JOptionPane.showMessageDialog(this, Values);
		}
	}
}
